package com.hankol.newretail.viewmodel

import androidx.lifecycle.MutableLiveData
import com.baselibrary.base.BasicListBean
import com.baselibrary.base.mvvm.BaseViewModel
import com.hankol.newretail.bean.GoodListBean
import com.hankol.newretail.bean.HomeMallInfoBean
import com.hankol.newretail.bean.MallTabBean
import com.hankol.newretail.bean.ShopCartNumData
import com.hankol.newretail.respository.NewReatilRequestManager

/*新零售-商城首页*/
class HomeMallViewModel : BaseViewModel() {
    var goodsDataListLD: MutableLiveData<BasicListBean<GoodListBean>> = MutableLiveData()
    var homeDataLD: MutableLiveData<HomeMallInfoBean> = MutableLiveData()
    var categoryLD: MutableLiveData<List<MallTabBean>> = MutableLiveData()
    var shopCartNumLD: MutableLiveData<ShopCartNumData> = MutableLiveData()

    //全部 商品  分页列表
    var allStoreGoodsLD: MutableLiveData<BasicListBean<GoodListBean>> = MutableLiveData()

    //获取商城首页相关数据
    fun requestHomeMallInfo() {
        NewReatilRequestManager.getInstance().requestHomeMallInfo(homeDataLD)
    }

    //购物车商品数量
    fun reqShopCartNum() {
        NewReatilRequestManager.getInstance().reqShopCartNum(shopCartNumLD)
    }

    //获取商城首页相关数据
    fun requestCategoryList() {
        NewReatilRequestManager.getInstance().requestCategoryList(categoryLD)
    }

    //获取商城分类 商品列表
    fun requestGoodClassifyList(type: String, page: Int) {
        NewReatilRequestManager.getInstance().requestGoodClassifyList(type, page, goodsDataListLD)
    }

    /**
     *全部商品  分页列表
     */
    fun reqAllStoreGoodsList(shopId: Int, page: Int) {
        NewReatilRequestManager.getInstance().reqAllStoreGoods(allStoreGoodsLD, shopId, page, 20)
    }

}